package com.shwread.android.qysw.activity;

import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.shwread.android.qysw10000182.R;
import com.shwread.android.ui.customview.AlignTextView;


/**
 * OrderMenuFoodDetailActivity
 * 
 * @Description：菜品详情界面
 * @Author：zhangdong
 * @Date：2015年6月19日上午9:03:22
 */
public class OrderMenuFoodDetailActivity
        extends
        BaseBusinessActivity
        implements
        OnClickListener
{
	private Context       context;
	private Button        btnBack;
	private ImageView     ivImg;
	private TextView      tvName;
	private AlignTextView tvDetail;
	private ImageButton   ibAdd;
	private LinearLayout  llIntroduce;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.om_food_detail);
		this.context = this;
		initView();
		setListener();
	}
	
	private Handler handler = new Handler()
	                        {
		                        @Override
		                        public void handleMessage(Message msg) {
			                        switch (msg.what) {
			                        
										default:
											break;
									}
								}
	                        };
	
	private void setListener() {
		btnBack.setOnClickListener(this);
		ibAdd.setOnClickListener(this);
	}
	
	@Override
	protected void onResume() {
		super.onResume();
	}
	
	private void initView() {
		btnBack = (Button) findViewById(R.id.common_header_back);
		ivImg = (ImageView) findViewById(R.id.iv_om_food_detail);
		tvName = (TextView) findViewById(R.id.tv_om_food_detail_name);
		
		ibAdd = (ImageButton) findViewById(R.id.ib_om_food_detail);
		
		llIntroduce = (LinearLayout) findViewById(R.id.ll_om_food_detail_introduce);
		DisplayMetrics outMetrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(outMetrics);
		int width = outMetrics.widthPixels;
		int height = outMetrics.heightPixels;
		int textSize = width / 22;
		if (width > height)
		{
			textSize = height / 22;
		}
		tvDetail = new AlignTextView(context, Color.parseColor("#8c8c8c"));
		LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		int magin = 48;
		params.setMargins(magin, 0, magin, magin);
		llIntroduce.addView(tvDetail, params);
		tvDetail.ini("肉细多汁，口感鲜嫩。煎制牛排也有很多讲究，既要能够将牛肉表面迅速加热，又不能使它们的纤维破裂，这就需要厨师的经验和手艺。\n" + "一块煎好的西冷牛排会散发出丝丝浅浅的香气，醋酸汁浇在牛排四周一圈，牛排呈现一种非常独特的暗金色，用餐刀切开牛排，里面的牛肉却是漂亮的粉红色，汁水很多。\n" +
		//				"拎起一小块牛排丢到嘴里，能清楚感受到汁水随着牙齿的咀嚼而散溢开来，烤肉的香味很好地传递到舒展口腔的每一个味蕾，在其中盘旋游走，把牛肉那种原始的口味发挥得淋漓尽致。\n" +
		//				"肉细多汁，口感鲜嫩。煎制牛排也有很多讲究，既要能够将牛肉表面迅速加热，又不能使它们的纤维破裂，这就需要厨师的经验和手艺。\n" +
		//				"一块煎好的西冷牛排会散发出丝丝浅浅的香气，醋酸汁浇在牛排四周一圈，牛排呈现一种非常独特的暗金色，用餐刀切开牛排，里面的牛肉却是漂亮的粉红色，汁水很多。\n" +
		"拎起一小块牛排丢到嘴里，能清楚感受到汁水随着牙齿的咀嚼而散溢开来，烤肉的香味很好地传递到舒展口腔的每一个味蕾，在其中盘旋游走，把牛肉那种原始的口味发挥得淋漓尽致。\n", width - magin * 2, textSize);
	}
	
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.common_header_back:
				finish();
				break;
			case R.id.ib_om_food_detail:
				break;
			default:
				break;
		}
	}
	
	@Override
	public Handler getUIHandler() {
		return handler;
	}
	
}
